package com.wxy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import com.wxy.client.userClient;
import com.wxy.dao.orderMapper;
import com.wxy.domain.User;
import com.wxy.domain.order;

@Component("orderService")
public class orderServiceImpl implements orderService{
	@Autowired
	private orderMapper orderMapper;
	@Autowired
	private RestTemplate restTemplate;
	@Autowired
	private userClient userClient;
	@Override
	public order findById(int id) {
		// TODO 自动生成的方法存根
		order order=orderMapper.findById(id);
//		String url="http://userservice/sc01/getId?id="+order.getUserid();
//		User user=restTemplate.getForObject(url,User.class);
		User user=userClient.findById(order.getUserid());
		order.setUser(user);
		return order;
	}

}
